<?php
/**
 * Created by PhpStorm.
 * User: Dave
 * Date: 2018/5/4
 * Time: 14:07
 */

ini_set('display_errors', 1);
error_reporting(-1);
require_once '/data/wwwroot/g_vendor/autoload.php';

use Biz\service\ShopCategoryEntrance as sShopCategoryEntrance;
use Biz\cache\CategoryEntrance   as cCarouselBanner;

try{

    $time = date('Y-m-d H:i:s');
    $categoryData  = sShopCategoryEntrance::getCategoryEntrance($time) ? : [];
    foreach($categoryData as $info){
        sShopCategoryEntrance::formatInfos($info);
        $list[] = $info;

    }
    cCarouselBanner::setCategoryEntrance(sShopCategoryEntrance::CATEGORY_ENTRANCE_CACHHE_NAME, $list);
    echo printf("%s,%s",date('Y-m-d H:i:s'),'同步成功');
} catch (\Exception $e){

    echo printf("出错,%s",$e->getMessage());
}